package com.jims.api.v1.controller.weixin;


import java.io.*;

public class MyConfig extends WXPayConfig{


    private byte[] certData;

    public MyConfig() throws Exception {
        /*String certPath = "/path/to/apiclient_cert.p12";
        File file = new File(certPath);
        InputStream certStream = new FileInputStream(file);
        this.certData = new byte[(int) file.length()];
        certStream.read(this.certData);
        certStream.close();*/
    }

    public String getAppID() {
        return "wxad96e851b422b222";
//        return "wxf83e00f1c6e8c8e3";
    }

    public String getMchID() {
        return "1494886542";
//        return "1259790701";
    }

    public String getKey() {
        return "jCooyGd20lud6QQ6Vs5FXkYGKBn0K0Mw";
//        return "c9613dee19614e039be182636d70efc1";
    }

    public InputStream getCertStream() {
        ByteArrayInputStream certBis = new ByteArrayInputStream(this.certData);
        return certBis;
    }

    public int getHttpConnectTimeoutMs() {
        return 8000;
    }

    public int getHttpReadTimeoutMs() {
        return 10000;
    }

    IWXPayDomain getWXPayDomain() {
        return new IWXPayDomain() {
            public void report(String domain, long elapsedTimeMillis, Exception ex) {

            }

            public DomainInfo getDomain(WXPayConfig config) {
                return new DomainInfo("api.mch.weixin.qq.com",false);
            }
        };
    }
}